package de.hft_stuttgart.dsa.ctt.model;

/**
 * @author Eduard Tudenhoefner
 */
public class Room implements Comparable<Room> {
	private String roomId;
	private int capacity;

	/**
	 * 
	 */
	public Room() {
		super();
	}

	public Room(String roomLine) {
		String[] roomSpecification = roomLine.split(" ");
		setRoomId(roomSpecification[0]);
		setCapacity(Integer.parseInt(roomSpecification[1]));

	}

	/**
	 * @param roomId
	 * @param capacity
	 */
	public Room(String roomId, int capacity) {
		super();
		this.roomId = roomId;
		this.capacity = capacity;
	}

	public String getRoomId() {
		return roomId;
	}

	public void setRoomId(String roomId) {
		this.roomId = roomId;
	}

	public int getCapacity() {
		return capacity;
	}

	public void setCapacity(int capacity) {
		this.capacity = capacity;
	}

	/**
	 * @see Comparable#compareTo(Object) Compares a room with this room.
	 * @return Positive value if this object has less capacity than the received
	 *         one and vice versa.
	 */
	@Override
	public int compareTo(Room other) {
		// return getCapacity() - room.getCapacity();
		// TODO: @Matze is this correctly implemented? See Javadoc of compareTo.
		return other.getCapacity() - this.getCapacity();
	}

	@Override
	public String toString() {

		return "RoomId: " + roomId + ", Capacity: " + capacity;
	}

}
